<template>
  <el-drawer
    class="drawer-order-detail"
    :title="title"
    :visible.sync="show"
    direction="rtl"
    :size="size"
    @close="close"
    append-to-body>
    <div class="drawer-content-item">
      <el-form ref="form" label-position="top" :model="form" label-width="0">
        <div class="flex-between-center content-padding">
          <el-row class="flex-1">
            <el-col :span="24">
              <el-form-item label="">
                <div class="fw-b font-s-20">{{form.orderNo}} - {{form.name}}</div>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <div>
                <i class="userinfo-icon el-icon-mobile-phone"></i>
                <span>{{form.phone || '-'}}</span>
              </div>
            </el-col>
            <el-col :span="7">
              <div>
                <i class="userinfo-icon el-icon-postcard"></i>
                <span>{{form.idCard || '-'}}</span>
              </div>
            </el-col>
            <el-col :span="3">
              <div>
                <i class="userinfo-icon el-icon-user"></i>
                <span>{{form.ethnicity || '-'}}</span>
              </div>
            </el-col>
            <el-col :span="3">
              <div>
                <i v-if="form.sexCode==1" class="userinfo-icon el-icon-female"></i>
                <i v-else class="userinfo-icon el-icon-male"></i>
                <span>{{form.sexCode==1?'女':'男'}}</span>
              </div>
            </el-col>
          </el-row>
          <div class="order-right-btn">
            <el-button-group>
              <el-button size="mini" type="primary" v-if="form.applyBookPdf" @click="windowOpen(form.applyBookPdf)">申请书</el-button>
              <el-button size="mini" type="primary" v-if="form.signMaterial" @click="windowOpen(form.signMaterial)">融资合同</el-button>
            </el-button-group>
            <div class="order-status-img">
              <img src="@/assets/images/custom-level-1.png">
              <!-- <img v-if="form.bigApproveStatus" :src="require('@/assets/images/big-status-'+form.bigApproveStatus+'.png')"> -->
            </div>
          </div>
          
        </div>
      </el-form>
    </div>
    <div class="drawer-content-item">
      <div class="order-progress-box">
        <div v-if="form.approveStatus!=13 || index<form.bigApproveStatus" :class="{active:index<form.bigApproveStatus}" v-for="(item,index) in progressStatus" :key="index">{{item.label}}</div>
        <div v-if="form.approveStatus==13" class="active">取消</div>
      </div>
    </div>
    <div class="drawer-content-item">
      <el-tabs v-model="tabsCurrent" type="card">
        <el-tab-pane label="申请信息" name="1">
          <el-form label-position="top">
            <div class="item-title-box">申请信息</div>
            <el-row :gutter="20" class="form-detail-top-box">
              <el-col :span="6">
                <el-form-item label="申请金额">
                  {{form.applyAmount}} 元
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="申请期数">
                  {{form.periodNum}} 期
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="还款方式">
                  {{selectDictLabel(dict.type.repayment_method,form.repayMethod) || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="申请时间">
                  {{form.applyTime}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="申请产品">
                  {{form.productName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="融资用途">
                  {{selectDictLabel(dict.type.loan_purpose,form.purpose) || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="业务经理">
                  {{form.realName || '-'}}
                  <el-button style="padding:0;margin-left:5px;" icon="el-icon-edit" type="text" @click="handleSalesman()">{{form.sysUserId?'调整':'绑定'}}</el-button>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="联系电话">
                  {{form.phonenumber || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="所属门店">
                  {{form.sysDeptName || '-'}}
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <template v-if="form.expand && form.approveStatus>0">
            <el-form label-position="top">
              <div class="item-title-box">个人资料</div>
              <el-row :gutter="20" class="form-detail-top-box">
                <el-col :span="6">
                  <el-form-item label="教育程度">
                    {{selectDictLabel(dict.type.education_level,form.expand.educationLevel) || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="本地房产">
                    {{form.expand.localAssets==1?'拥有':'未拥有'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="居住年限">
                    {{form.expand.residenceYears || 0}} 年
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="居住性质">
                    {{selectDictLabel(dict.type.residence_type,form.expand.residenceType) || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="婚姻状况">
                    {{selectDictLabel(dict.type.marital_status,form.expand.marriageStatus) || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="就业情况">
                    {{selectDictLabel(dict.type.employment_status,form.expand.employmentStatus) || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="年收入">
                    {{form.expand.yearIncome || 0}} 万元
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="工作单位">
                    {{form.expand.workplace || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="居住地址">
                    {{form.expand.residenceArea || '-'}} {{form.expand.residenceAddress || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="单位地址">
                    {{form.expand.companyAddress || '-'}} {{form.expand.companyDetailedAddress || '-'}}
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <el-form label-position="top">
              <div class="item-title-box">紧急联系人</div>
              <div>
                <el-table :data="form.emergencyList">
                  <el-table-column label="与客户关系" align="center" prop="relationship"></el-table-column>
                  <el-table-column label="姓名" align="center" prop="emergencyName"></el-table-column>
                  <el-table-column label="电话" align="center" prop="emergencyPhone"></el-table-column>
                </el-table>
              </div>
            </el-form>
            <el-form label-position="top">
              <div class="item-title-box">担保人员</div>
              <div>
                <el-table :data="form.orderAssureList">
                  <el-table-column label="担保人姓名" align="center" prop="assureName" />
                  <el-table-column label="身份证号" align="center" prop="emergencyIdCard" />
                  <el-table-column label="联系电话" align="center" prop="emergencyPhone" />
                  <el-table-column label="与客户关系" align="center" prop="relationship" width="100" />
                  <el-table-column label="身份证正反面" align="center" width="200">
                    <template slot-scope="scope">
                      <imagePreview :url="scope.row.idCardPhoto"/>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </el-form>
          </template>
        </el-tab-pane>
        <el-tab-pane label="车辆信息" name="2" v-if="form.expand">
          <el-form label-position="top">
            <div class="item-title-box">基本信息</div>
            <el-row :gutter="20" class="form-detail-top-box">
              <el-col :span="6">
                <el-form-item label="车牌号">
                  {{form.expand.licensePlateNumber || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车架号">
                  {{form.expand.vinNumber || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="首次上牌">
                  {{form.expand.firstRegistrationDate || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="上牌地区">
                  {{form.expand.brandProvinceName || '-'}}/{{form.expand.brandCityName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="里程数">
                  {{form.expand.mileage || '0'}} 公里
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车辆类型">
                  {{form.expand.vehicleType || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="使用性质">
                  {{form.expand.useNature || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="发动机号">
                  {{form.expand.engineNumber || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="注册日期">
                  {{form.expand.registrationDate || '-'}}
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <el-form label-position="top" v-if="form.carAuthStatus>1">
            <div class="item-title-box">车辆图片</div>
            <el-row :gutter="20" class="form-detail-top-box">
              <el-col :span="6">
                <el-form-item label="行驶证" prop="drivingLicense">
                  <imagePreview :url="form.expand.drivingLicense"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="登记证1-2页" prop="vehicleRegistration">
                  <imagePreview :url="form.expand.vehicleRegistration"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="登记证3-4页" prop="carUrl7">
                  <imagePreview :url="form.expand.carUrl7"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="登记证5-6页" prop="carUrl8">
                  <imagePreview :url="form.expand.carUrl8"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="登记证7-8页" prop="carUrl9">
                  <imagePreview :url="form.expand.carUrl9"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="人车合影" prop="carUrl1">
                  <imagePreview :url="form.expand.carUrl1"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="行驶公里数" prop="carUrl2">
                  <imagePreview :url="form.expand.carUrl2"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="左侧车身" prop="carUrl3">
                  <imagePreview :url="form.expand.carUrl3"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="右侧车身" prop="carUrl4">
                  <imagePreview :url="form.expand.carUrl4"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="正面车头" prop="carUrl5">
                  <imagePreview :url="form.expand.carUrl5"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车尾照片" prop="carUrl6">
                  <imagePreview :url="form.expand.carUrl6"/>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <el-form label-position="top" v-if="form.carAuthStatus==4 || form.carAuthStatus==111">
            <div class="flex-between-center">
              <div class="item-title-box">车辆评估信息</div>
              <el-button class="mar-r-20" v-if="authDetail.assessmentReportPdf" size="mini" type="primary" @click="windowOpen(authDetail.assessmentReportPdf)">查看评估报告</el-button>
            </div>
            <el-row :gutter="20" class="form-detail-top-box">
              <el-col :span="6">
                <el-form-item label="评估结果">
                  通过
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="精真估订单号">
                  {{authDetail.orderNo || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="评估日期">
                  {{authDetail.assessmentDate || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="VIN码">
                  {{authDetail.vin || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="B2C评估价格">
                  {{authDetail.assessmentPriceB2c || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="C2B评估价格">
                  {{authDetail.assessmentPriceC2b || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="B2C首月剩余价值">
                  {{authDetail.firstMonthResidualB2c || '-'}} 万元
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="C2B首月剩余价值">
                  {{authDetail.firstMonthResidualC2b || '-'}} 万元
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="B2C第二月剩余价值">
                  {{authDetail.secondMonthResidualB2c || '-'}} 万元
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="C2B第二月剩余价值">
                  {{authDetail.secondMonthResidualC2b || '-'}} 万元
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="B2C第三月剩余价值">
                  {{authDetail.thirdMonthResidualB2c || '-'}} 万元
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="C2B第三月剩余价值">
                  {{authDetail.thirdMonthResidualC2b || '-'}} 万元
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车辆牌照">
                  {{authDetail.carLicense || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="公司代码">
                  {{authDetail.companyCode || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="车辆名称">
                  {{authDetail.carName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车辆类型">
                  {{authDetail.carType || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="使用年限">
                  {{authDetail.carUseTime || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="发证日期">
                  {{authDetail.certificateDate || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车辆颜色">
                  {{authDetail.color || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="驾驶模式">
                  {{authDetail.drivingMode || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="发动机号">
                  {{authDetail.engineNum || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="燃料类型">
                  {{authDetail.fuel || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="排气量">
                  {{authDetail.exhaust || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="品牌ID">
                  {{authDetail.makeId || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="品牌名称">
                  {{authDetail.makeName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车系ID">
                  {{authDetail.modelId || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车系名称">
                  {{authDetail.modelName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="里程数">
                  {{authDetail.mileage || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="制造商">
                  {{authDetail.manufacturerName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="制造商价格">
                  {{authDetail.manufacturerPrice || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="联系人">
                  {{authDetail.orderName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="联系电话">
                  {{authDetail.orderPhone || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="变速器类型">
                  {{authDetail.transmissionType || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车主姓名">
                  {{authDetail.preCarOwner || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车主地址">
                  {{authDetail.preCarOwnerAddr || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="生产时间">
                  {{authDetail.productionTime || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="记录品牌">
                  {{authDetail.recordBrand || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="记录日期">
                  {{authDetail.recordDate || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="注册省份">
                  {{authDetail.registerProv || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="注册城市">
                  {{authDetail.registerCity || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="座位数">
                  {{authDetail.seating || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车型ID">
                  {{authDetail.styleId || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车型名称">
                  {{authDetail.styleName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="服务类型">
                  {{authDetail.service || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="机构名称">
                  {{authDetail.sourceName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="是否乘用车">
                  {{authDetail.driverFlag?'是':'否'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="年款">
                  {{authDetail.styleYear || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="过户次数">
                  {{authDetail.transferCount || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="三证是否齐全">
                  {{authDetail.threeCertificateFlag?'是':'否'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="是否抵押">
                  {{authDetail.isMortgage?'是':'否'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="事故车">
                  {{authDetail.accidentFlag?'是':'否'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="是否新能源">
                  {{authDetail.isNewEnergy?'是':'否'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="水泡车">
                  {{authDetail.waterFlag?'是':'否'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="火烧车">
                  {{authDetail.burnFlag?'是':'否'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="调表超过1万公里">
                  {{authDetail.adjustMileageOverOneFlag?'是':'否'}}
                </el-form-item>
              </el-col>
              <el-col :span="24" v-if="authDetail.videoPath">
                <el-form-item label="视频路径">
                  {{authDetail.videoPath}}
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="必拍图片">
                  <imagePreview :url="authDetail.imageList"/>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="附加图片">
                  <imagePreview :url="authDetail.appendImageList"/>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="评估描述">
                  <div>{{authDetail.assessmentDes || '-'}}</div>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="风控情况" name="3" v-if="form.approveStatus>1">
          <div class="content-padding" style="padding-bottom:0">
            <el-radio-group v-model="tabsCurrent2" size="small">
              <el-radio-button label="1">优分数据</el-radio-button>
              <el-radio-button label="2">冰鉴数据</el-radio-button>
              <el-radio-button label="3">百融数据</el-radio-button>
              <el-radio-button label="4">法海数据</el-radio-button>
              <el-radio-button label="5">同盾数据</el-radio-button>
            </el-radio-group>
          </div>
          <bairong :info="form" v-if="tabsCurrent2=='3' && form.baiRongJson"></bairong>
          <!-- <el-form label-position="top" v-if="tabsCurrent2=='3' && form.baiRongJson">
            <el-row :gutter="20" class="form-detail-top-box">
              <el-col :span="6">
                <el-form-item label="报告编号">
                  {{form.orderNo || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="报告生成时间">
                  {{form.baiRongTime || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="融安分">
                  <div class="color-price">{{form.vinNumber || '-'}} 分</div>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="" class="text-c mar-t-20">
                  <el-button type="primary" size="small" @click="windowOpen(form.signMaterial)" plain>查看完整报告</el-button>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form> -->
        </el-tab-pane>
        <el-tab-pane label="审核进展" name="4">
          <el-timeline class="content-padding">
            <el-timeline-item size="large" :type="index==0?'primary':''" :icon="index==0?'el-icon-check':''" :timestamp="item.handleTime" placement="top" v-for="(item,index) in processList" :key="index">
              <el-card>
                <div class="fw-b font-s-16">{{item.handleContent}}</div>
                <div class="color-999 mar-t-10">经办人：{{item.handleRealName || '-'}}（{{item.handleDeptName || '-'}}）</div>
              </el-card>
            </el-timeline-item>
          </el-timeline>
        </el-tab-pane>
        <el-tab-pane label="账单信息" name="5" v-if="form.isFund">
          <el-table :data="billList">
            <el-table-column label="账单ID" align="center" prop="id"/>
            <el-table-column label="还款期" align="center" prop="whichPeriodNum" :formatter="row=>'第'+row.whichPeriodNum+'期'"/>
            <el-table-column label="还款日" align="center" prop="waitRepayTime"/>
            <el-table-column label="应还金额" align="center" prop="waitRepayAmount"/>
            <el-table-column label="还款时间" align="center" prop="finishRepayTime" :formatter="row=>row.finishRepayTime || '-'"/>
            <el-table-column label="还款金额" align="center" prop="finishRepayAmont" :formatter="row=>row.finishRepayAmont || '-'"/>
            <el-table-column label="还款状态" align="center">
              <template slot-scope="scope">
                <el-tag size="small" type="warning" v-if="scope.row.repayStatus==0">未还款</el-tag>
                <el-tag size="small" type="danger" v-if="scope.row.repayStatus==1">已逾期</el-tag>
                <el-tag size="small" type="success" v-if="scope.row.repayStatus==2">已还款</el-tag>
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center">
                <template slot-scope="scope">
                  <el-button v-if="scope.row.repayStatus==1" type="text" size="small" icon="el-icon-bank-card" @click="handleCollection(scope.row)">催收</el-button>
                </template>
              </el-table-column>
          </el-table>
          <pagination
            layout="total, prev, pager, next"
            :total="billTotal"
            :page.sync="billQueryParams.pageNum"
            :limit.sync="billQueryParams.pageSize"
            @pagination="selectBillPage"
          />
        </el-tab-pane>
        <el-tab-pane label="贷中信息" name="6" v-if="form.orderRepayment || (form.expand && form.approveStatus>0) || (form.serviceExpand && form.serviceApproveStatus>0)">
          <el-form label-position="top" v-if="form.orderRepayment">
            <div class="item-title-box">还款银行卡</div>
            <el-row :gutter="20" class="form-detail-top-box">
              <el-col :span="6">
                <el-form-item label="开户银行">
                  {{form.orderRepayment.repaymentBankName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="银行卡号">
                  {{form.orderRepayment.repaymentBankCard || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="账户名">
                  {{form.orderRepayment.repaymentAccountName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="手机号">
                  {{form.orderRepayment.repaymentPhone || '-'}}
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <el-form label-position="top" v-if="form.expand && form.approveStatus>0">
            <div class="item-title-box">保险信息</div>
            <el-row :gutter="20" class="form-detail-top-box">
              <el-col :span="6">
                <el-form-item label="登记机关" prop="registrationAuthority">
                  {{form.expand.registrationAuthority || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="登记编号" prop="registrationNo">
                  {{form.expand.registrationNo || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="发证机关" prop="issuingAuthority">
                  {{form.expand.issuingAuthority || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="发证日期" prop="issuingDate">
                  {{form.expand.issuingDate || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="保险公司" prop="insuranceCompany">
                  {{form.expand.insuranceCompany || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="被保人姓名" prop="insuredName">
                  {{form.expand.insuredName || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="商业险到期日" prop="expirationDate">
                  {{form.expand.expirationDate || '-'}}
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车损险金额" prop="damageInsuranceAmount">
                  {{form.expand.damageInsuranceAmount || 0}} 元
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="第三方责任险金额" prop="thirdInsuranceAmount">
                  {{form.expand.thirdInsuranceAmount || 0}} 元
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <template v-if="form.serviceExpand && form.serviceApproveStatus>0">
            <el-form label-position="top">
              <div class="item-title-box">权证资料</div>
              <el-row :gutter="20" class="form-detail-top-box">
                <el-col :span="6">
                  <el-form-item label="登记编号">
                    {{form.serviceExpand.carRegistrationNo || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="登记日期">
                    {{form.serviceExpand.carRegistrationDate || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="经办人">
                    {{form.serviceExpand.carHandler || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="使用性质">
                    {{form.serviceExpand.carUseNature || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="获取方式">
                    {{form.serviceExpand.carAcquisitionMethod || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="出厂日期">
                    {{form.serviceExpand.carFactoryDate || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="发证日期">
                    {{form.serviceExpand.carIssueDate || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="发证机关">
                    {{form.serviceExpand.carIssueAuthority || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="权证照片">
                    <imagePreview :url="form.serviceExpand.carWarrantPhoto"/>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <el-form label-position="top">
              <div class="item-title-box">GPS资料</div>
              <div>
                <el-table :data="form.serviceExpand.gpsList">
                  <el-table-column label="设备编号" align="center" prop="equipmentNo" />
                  <el-table-column label="设备类型" align="center" prop="equipmentType" />
                  <el-table-column label="设备地址" align="center" prop="equipmentAddress" />
                </el-table>
              </div>
            </el-form>
            <el-form label-position="top">
              <div class="item-title-box">寄件资料</div>
              <el-row :gutter="20" class="form-detail-top-box">
                <el-col :span="6">
                  <el-form-item label="收件人">
                    {{form.serviceExpand.recipientName || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="收件电话">
                    {{form.serviceExpand.recipientPhone || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="收件地址">
                    {{form.serviceExpand.recipientAreaName || '-'}} {{form.serviceExpand.recipientAddress || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="寄件人">
                    {{form.serviceExpand.senderName || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="寄件电话">
                    {{form.serviceExpand.senderPhone || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="收件地址">
                    {{form.serviceExpand.senderArea || '-'}} {{form.serviceExpand.senderAddress || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="移交方式">
                    {{selectDictLabel(dict.type.sender_method,form.serviceExpand.senderMethod) || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="18">
                  <el-form-item label="备注信息">
                    {{form.serviceExpand.senderNotes || '-'}}
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <el-form label-position="top">
              <div class="item-title-box">补充资料</div>
              <el-row :gutter="20" class="form-detail-top-box">
                <el-col :span="6">
                  <el-form-item label="商业险到期时间">
                    {{form.serviceExpand.insuranceExpirationDate || '-'}}
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="驾照正面">
                    <imagePreview :url="form.serviceExpand.drivingLicenseFront"/>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="驾照反面">
                    <imagePreview :url="form.serviceExpand.drivingLicenseBack"/>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </template>
        </el-tab-pane>
        <el-tab-pane label="影像资料" name="7" v-if="form.expand && form.approveStatus>0">
          <el-form label-position="top">
            <div class="item-title-box">进件材料</div>
            <el-row :gutter="20" class="form-detail-top-box">
              <el-col :span="6">
                <el-form-item label="驾照正面" prop="drivingLicenseFront">
                  <imagePreview :url="form.expand.drivingLicenseFront"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="驾照反面" prop="drivingLicenseBack">
                  <imagePreview :url="form.expand.drivingLicenseBack"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="保单" prop="insurancePolicy">
                  <imagePreview :url="form.expand.insurancePolicy"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="融租申请书" prop="financingApplication">
                  <imagePreview :url="form.expand.financingApplication"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="车辆登记证" prop="vehicleRegistration">
                  <imagePreview :url="form.expand.vehicleRegistration"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="行驶证" prop="drivingLicense">
                  <imagePreview :url="form.expand.drivingLicense"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="收入证明" prop="incomeProof">
                  <imagePreview :url="form.expand.incomeProof"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="财力证明" prop="financialProof">
                  <imagePreview :url="form.expand.financialProof"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="其他资料" prop="otherMaterials">
                  <imagePreview :url="form.expand.otherMaterials"/>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <el-form label-position="top">
            <div class="item-title-box">图片资料</div>
            <el-row :gutter="20" class="form-detail-top-box">
              <el-col :span="12">
                <el-form-item label="图片资料" prop="imageUrl">
                  <imagePreview :url="form.expand.imageUrl"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="视频资料" prop="videoUrl">
                  <videoUpload size="mini" v-model="form.expand.videoUrl" :limit="0" :isShowTip="false"/>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="催收记录" name="8" v-if="form.isFund">
          <el-table :data="collectionList">
            <el-table-column label="账单ID" align="center" prop="billId"/>
            <el-table-column label="还款期" align="center" prop="whichPeriodNum" :formatter="row=>'第'+row.whichPeriodNum+'期'"/>
            <el-table-column label="还款日" align="center" prop="waitRepayTime"/>
            <el-table-column label="应还金额" align="center" prop="waitRepayAmount"/>
            <el-table-column label="通话结果" align="center">
              <template slot-scope="scope">
                <el-tag size="small" :type="scope.row.callResult==1?'success':'danger'">{{selectDictLabel(dict.type.call_result,scope.row.callResult) || '-'}}</el-tag>
              </template>
            </el-table-column>
            <el-table-column label="催收结果" align="center">
              <template slot-scope="scope">
                <el-tag size="small" :type="scope.row.collectionResult==1?'success':'danger'">{{selectDictLabel(dict.type.collection_result,scope.row.collectionResult) || '-'}}</el-tag>
              </template>
            </el-table-column>
            <el-table-column label="催收备注" align="center" prop="collectionRemark" width="200"/>
          </el-table>
          <pagination
            layout="total, prev, pager, next"
            :total="collectionTotal"
            :page.sync="collectionQueryParams.pageNum"
            :limit.sync="collectionQueryParams.pageSize"
            @pagination="selectOrderInfoCollectionRecordPage"
          />
        </el-tab-pane>
      </el-tabs>
    </div>
    <el-form class="drawer-content-item" ref="formExam" :model="formExam" :rules="rulesExam" label-width="auto" v-if="isExam && (((form.approveStatus==1 || form.approveStatus==8) && userInfo.userId==form.firstSysUserId) || (form.approveStatus==5 && userInfo.userId==form.secondSysUserId) || (form.approveStatus==10 && hasPostName(['18'])) || (form.approveStatus==12 && form.serviceApproveStatus==1))">
      <div class="item-title-box">{{textExam}}提交</div>
      <el-row class="content-padding">
        <el-col :span="24">
          <el-form-item label="初审结果" prop="approveStatus" v-if="textExam=='初审'">
            <el-radio-group v-model="formExam.approveStatus" @change="formExam.isNeedAssure=0">
              <el-radio :label="5">初审通过</el-radio>
              <el-radio :label="3">业务拒绝，客户不符合</el-radio>
              <el-radio :label="4">资料不全，请完善</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="复审结果" prop="approveStatus" v-if="textExam=='复审'">
            <el-radio-group v-model="formExam.approveStatus" @change="formExam.isNeedAssure=0">
              <el-radio :label="10">复审通过</el-radio>
              <el-radio :label="7">业务拒绝，客户不符合</el-radio>
              <el-radio :label="8">资料不全，请初审完善</el-radio>
              <el-radio :label="9">资料不全，请门店完善</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="终审结果" prop="approveStatus" v-if="textExam=='终审'">
            <el-radio-group v-model="formExam.approveStatus" @change="formExam.isNeedAssure=0">
              <el-radio :label="12">终审通过</el-radio>
              <el-radio :label="11">终审拒绝</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="审核结果" prop="serviceApproveStatus" v-if="textExam=='审核'">
            <el-radio-group v-model="formExam.serviceApproveStatus">
              <el-radio :label="3">审核通过</el-radio>
              <el-radio :label="2">审核拒绝</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="补充担保人" prop="isNeedAssure" v-if="formExam.approveStatus==4 || formExam.approveStatus==8 || formExam.approveStatus==9">
            <el-radio-group v-model="formExam.isNeedAssure">
              <el-radio :label="0">不需要</el-radio>
              <el-radio :label="1">需要</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="备注信息" prop="remark">
            <el-input v-model="formExam.remark" type="textarea" placeholder="请输入备注信息" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="drawer-footer" v-if="isExam && (((form.approveStatus==1 || form.approveStatus==8) && userInfo.userId==form.firstSysUserId) || (form.approveStatus==5 && userInfo.userId==form.secondSysUserId) || (form.approveStatus==10 && hasPostName(['18'])) || (form.approveStatus==12 && form.serviceApproveStatus==1))">
      <el-button type="primary" @click="confirmExam">{{textExam}}提交</el-button>
      <el-button @click="close">取 消</el-button>
    </div>
    <!-- 业务经理 -->
    <el-dialog
      title="业务经理信息"
      :visible.sync="salesmanOpen"
      width="800px"
      append-to-body>
      <el-form ref="formSalesman" :model="formSalesman" :rules="rulesSalesman" label-width="95px">
        <div class="item-title-box">基本信息</div>
        <el-row class="form-detail-box mar-t-15">
          <el-col :span="24">
            <el-form-item label="业务经理：" prop="sysUserId">
              <div class="flex-align-center">
                <selectUser class="flex-1" size="small" v-if="isBind" placeholder="选择业务经理" v-model="formSalesman.sysUserId"></selectUser>
                <div v-else>{{form.realName || '-'}}</div>
                <el-button v-if="hasPostName(['11','55'])" class="mar-l-15" size="small" type="primary" @click="confirmSalesman()">{{isBind?'保存':'调整'}}</el-button>
                <el-button v-if="isBind" size="small" @click="confirmClose">取消</el-button>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="联系方式：" prop="remark">
              {{form.phonenumber || '-'}}
            </el-form-item>
          </el-col>
          <el-col :span="16">
            <el-form-item label="门店地址：" prop="remark">
              {{form.sysAddress || '-'}}
            </el-form-item>
          </el-col>
        </el-row>
        <div class="item-title-box mar-t-20">调整记录</div>
        <el-table class="mar-t-15" size="mini" :data="salesmanList" max-height="300px">
          <el-table-column label="原业务经理" align="center" prop="historyRealName" :formatter="row=>row.historyRealName?(row.historyRealName || '-')+'（'+(row.historyPhonenumber || '-')+'）':'-'" width="170"/>
          <el-table-column label="原所属门店" align="center" prop="historyDeptName" width="140" :formatter="row=>row.historyDeptName || '-'"/>
          <el-table-column label="现业务经理" align="center" prop="currentRealName" :formatter="row=>row.currentRealName?(row.currentRealName || '')+'（'+(row.currentPhonenumber || '-')+'）':'-'" width="170"/>
          <el-table-column label="现所属门店" align="center" prop="currentDeptName" width="140"/>
          <el-table-column label="调整时间" align="center" prop="createTime"/>
        </el-table>
      </el-form>
    </el-dialog>
    <!-- 业务经理 -->
    <el-dialog
      title="逾期催收"
      :visible.sync="collectionOpen"
      width="600px"
      append-to-body>
      <el-form ref="formCollection" :model="formCollection" :rules="rulesCollection" label-width="85px">
        <el-row>
          <el-col :span="24">
            <el-form-item label="通话结果" prop="callResult">
              <el-radio-group v-model="formCollection.callResult">
                <el-radio
                  v-for="dict in dict.type.call_result"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="催收结果" prop="collectionResult">
              <el-radio-group v-model="formCollection.collectionResult">
                <el-radio
                  v-for="dict in dict.type.collection_result"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="催收备注" prop="collectionRemark">
              <el-input v-model="formCollection.collectionRemark" type="textarea" placeholder="请输入催收备注" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormCollection">确 定</el-button>
        <el-button @click="collectionOpen=false">取 消</el-button>
      </div>
    </el-dialog>
  </el-drawer>
</template>

<script>
import { mapGetters } from 'vuex'
import bairong from "./bairong";
import { getForeseeOrder, getOrderProcess, selectBillPage, saveOrderInfoCollectionRecord, selectOrderInfoCollectionRecordPage, getThridAuthDetail, bindConcatSysUser, selectBindSysUserLogList } from "@/api/orderManage/foreseeOrder";
import { submitFirstApprove, submitSecondApprove, submitFinalApprove } from "@/api/examineManage/waitExamine";
import { approveServiceExpand } from "@/api/serveProvider/waitServeOrder";
export default {
  name: "OrderDetail",
  dicts: ['approve_status', 'repayment_method','loan_purpose', 'education_level', 'residence_type', 'marital_status', 'employment_status', 'sender_method', 'call_result', 'collection_result'],
  components: { bairong },
  computed: {
    ...mapGetters(['userInfo'])
  },
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    info: {
      type: Object,
      default: ()=>{}
    },
    title: {
      type: String,
      default: '订单详情'
    },
    size: {
      type: [String,Number],
      default: 1000
    },
    isExam: {
      type: Boolean,
      default: false
    },
  },
  data() {
    return {
      show:false,
      form: {},
      processList:[],
      progressStatus:[
        {label: '预审', value:1},
        {label: '录单', value:2},
        {label: '审批', value:3},
        {label: '绑卡', value:4},
        {label: '签约', value:5},
        {label: '合规', value:6},
        {label: '请款', value:7},
      ],
      tabsCurrent: '1',
      tabsCurrent2: '1',
      // 账单信息
      billQueryParams: {
        pageNum: 1,
        pageSize: 10
      },
      billTotal: 0,
      billList:[],
      // 催收信息
      collectionQueryParams: {
        pageNum: 1,
        pageSize: 10
      },
      collectionTotal: 0,
      collectionList:[],
      collectionOpen:false,
      formCollection:{},
      rulesCollection:{},
      // 业务经理
      salesmanOpen: false,
      formSalesman: {},
      rulesSalesman: {
        sysUserId: [
          { required: true, message: "业务经理不能为空", trigger: "change" }
        ]
      },
      salesmanList: [],
      isBind: false,
      // 审核
      textExam: '初审',
      formExam: {},
      rulesExam: {},
      // 认证详情
      authDetail: {}
    };
  },
  watch:{
    visible(){
      this.show = this.visible
      if(this.show){
        this.tabsCurrent = '1'
        this.tabsCurrent2 = '3'
        this.form = {}
        this.authDetail = {}
        this.billQueryParams.pageNum = 1
        this.billList = []
        this.billTotal = 0
        this.collectionQueryParams.pageNum = 1
        this.collectionList = []
        this.collectionTotal = 0
        this.getDetail();
      }
    }
  },
  methods: {
    getDetail() {
      getForeseeOrder({id:this.info.orderId || this.info.id}).then(response => {
        this.form = response.data;
        if(this.form.isFund){
          this.selectBillPage()
          this.selectOrderInfoCollectionRecordPage()
        }
        getOrderProcess({id:this.form.id}).then(response => {
          this.processList = response.data;
        });
        if(this.form.carAuthStatus==4 || this.form.carAuthStatus==111){
          getThridAuthDetail({orderId:this.form.id}).then(response => {
            response.data.appendImageList = response.data.appendImageList?JSON.stringify(JSON.parse(response.data.appendImageList).map(row=>{
              return {
                name: row.partCode,
                url: row.imageUrl
              }
            })):''
            response.data.imageList = response.data.imageList?JSON.stringify(JSON.parse(response.data.imageList).map(row=>{
              return {
                name: row.partCode,
                url: row.imageUrl
              }
            })):''
            this.authDetail = response.data;
          });
        }
        if(this.isExam && (((this.form.approveStatus==1 || this.form.approveStatus==8) && this.userInfo.userId==this.form.firstSysUserId) || (this.form.approveStatus==5 && this.userInfo.userId==this.form.secondSysUserId) || (this.form.approveStatus==10 && this.hasPostName(['18'])) || (this.form.approveStatus==12 && this.form.serviceApproveStatus==1))){
          this.formExam = {
            orderId: this.form.id,
            approveStatus: 5,
            isNeedAssure: 0
          }
          // 复审默认10
          if(this.form.approveStatus==5 && this.userInfo.userId==this.form.secondSysUserId){
            this.formExam.approveStatus = 10
            this.textExam = '复审'
          }
          // 终审默认12
          if(this.form.approveStatus==10 && this.hasPostName(['18'])){
            this.formExam.approveStatus = 12
            this.textExam = '终审'
          }
          // 放款审核
          if(this.form.approveStatus==12 && this.form.serviceApproveStatus==1){
            this.formExam = {
              orderId: this.form.id,
              serviceApproveStatus: 3
            }
            this.textExam = '审核'
          }
          setTimeout(()=>{
            document.querySelector('.drawer-order-detail .el-drawer__body').scrollTop = 9999
          },500)
        }
      });
    },
    selectBillPage(){
      this.billQueryParams.orderId=this.form.id
      selectBillPage(this.billQueryParams).then(response => {
        this.billList = response.data.records;
        this.billTotal = response.data.total
      });
    },
    selectOrderInfoCollectionRecordPage(){
      this.collectionQueryParams.orderId=this.form.id
      selectOrderInfoCollectionRecordPage(this.collectionQueryParams).then(response => {
        this.collectionList = response.data.records;
        this.collectionTotal = response.data.total
      });
    },
    // 查看业务经理
    handleSalesman(){
      this.formSalesman = {
        orderId: this.form.id,
        sysUserId: undefined,
        userId: this.form.userId
      }
      this.resetForm("formSalesman");
      selectBindSysUserLogList({userId:this.form.userId}).then(response => {
        this.salesmanList = response.data;
      });
      this.salesmanOpen = true
    },
    confirmSalesman(){
      if(this.isBind){
        this.$refs["formSalesman"].validate(valid => {
          if (valid) {
            bindConcatSysUser(this.formSalesman).then(response => {
              this.getDetail()
              this.handleSalesman()
              this.$modal.msgSuccess("业务经理调整成功");
              this.isBind = false
              this.$emit('confirm')
            });
          }
        });
      }else{
        this.isBind = true
      }
    },
    confirmClose(){
      this.resetForm("formSalesman");
      this.isBind = false
    },
    close(){
      this.$emit('update:visible', false)
      this.$emit('close')
    },
    confirmExam(){
      this.$refs["formExam"].validate(valid => {
        if (valid) {
          let api = submitFirstApprove
          if(this.textExam=='复审'){
            api = submitSecondApprove
          }
          if(this.textExam=='终审'){
            api = submitFinalApprove
          }
          if(this.textExam=='审核'){
            api = approveServiceExpand
          }
          api(this.formExam).then(response => {
            this.$modal.msgSuccess(this.textExam+"提交成功");
            this.$emit('update:visible', false)
            this.$emit('confirm')
          });
        }
      });
    },
    // 催收
    handleCollection(row){
      this.formCollection = {
        billId: row.id,
        callResult: 1,
        collectionResult: 1,
        collectionRemark: null
      }
      this.resetForm("formCollection");
      this.collectionOpen = true
    },
    submitFormCollection: function() {
      this.$refs["formCollection"].validate(valid => {
        if (valid) {
          saveOrderInfoCollectionRecord(this.formCollection).then(response => {
            this.$modal.msgSuccess("逾期账单催收提交成功");
            this.collectionOpen = false;
            this.selectOrderInfoCollectionRecordPage();
          });
        }
      });
    },
    windowOpen(url){
      window.open(url)
    }
  }
};
</script>